function doAR(url, form, id){
	appendUrl=url;
	if(url.indexOf('?')>0){
			appendUrl+="&P_AJAXREQ=true";
		
	}else{
		appendUrl+="?P_AJAXREQ=true";

	}
	if(id){
		appendUrl+="&refreshZone="+id;
	}
	$.post(appendUrl, preparePostData(document.forms[form]), 
			function(data){
		var contents = data.getElementsByTagName("block");
		for (i = 0; i < contents.length; i++) {
			var id = contents[i].getAttribute("id");
			contentHTML="";
			for (j = 0; j < contents[i].childNodes.length; j++) {
				if (contents[i].childNodes[j].data && contents[i].childNodes[j].data.length > 0) {
					contentHTML += contents[i].childNodes[j].data;
				}
			}
			$('#'+id).html(contentHTML);
		}
			});
}
function preparePostData(form) {
	var result = "";
	for (var i = 0; i < form.elements.length; i++) {
		if(result!=""){
			result+=",";
		}
		var el = form.elements[i];
		if (el.tagName.toLowerCase() == "select") {
			for (var j = 0; j < el.options.length; j++) {
				var op = el.options[j];
				if (op.selected) {
					result += "\""+encodeURIComponent(el.name) + "\":\"" + encodeURIComponent(op.value)+"\"";
				}
			}
		} else {
			if (el.tagName.toLowerCase() == "textarea") {
				result += "\"" + encodeURIComponent(el.name) + "\":\"" + encodeURIComponent(el.value)+"\"";
			} else {
				if (el.tagName.toLowerCase() == "input") {
					if (el.type.toLowerCase() == "checkbox" || el.type.toLowerCase() == "radio") {
						if (el.checked) {
							result += "\""+encodeURIComponent(el.name) + "\":\"" + encodeURIComponent(el.value)+"\"";
						}
					} else {
						if (el.type.toLowerCase() == "text" || el.type.toLowerCase() == "hidden") {
							result += "\""+encodeURIComponent(el.name) + "\":\"" + encodeURIComponent(el.value)+"\"";
						} else {
							result += "\""+encodeURIComponent(el.name) + "\":\"" + encodeURIComponent(el.value)+"\"";
						}
					}
				}
			}
		}
	}
	json='';
	eval("json={"+result+"}");
	return json;
}